package com.mjh.zhujianju.controller.supervise;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.livew.framework.interceptor.URLPermission;
import com.livew.framework.pojo.AjaxResult;
import com.livew.framework.utils.XTStringUtils;
import com.mjh.zhujianju.service.supervise.SupervisionService;
import com.mjh.zhujianju.vo.supervision.StatisticsVO;

/**
 * @author: Alex
 * @version: V1.0
 * @project: zhujianju
 * @package: com.mjh.zhujianju.controller.supervise
 * @description: description
 * @date: 2018/8/15
 * @time: 下午2:47
 */
@Controller
@RequestMapping("supervise/statistics")
public class StatisticsController{
	
	@Resource
	private SupervisionService supervisionService;
	
	@URLPermission
    @RequestMapping(value = "index")
    public String index(Model model) {
        return "supervise/statistics/index";
    }
    
    
    @RequestMapping(value="getStatistics",method=RequestMethod.POST)
    @ResponseBody
    public AjaxResult getStatistics(StatisticsVO vo) {
    	if(!XTStringUtils.isEmpty(vo.getStartDate())) {
    		vo.setStartDate(vo.getStartDate()+" 00:00:00");
    	}
    	if(!XTStringUtils.isEmpty(vo.getEndDate())) {
    		vo.setEndDate(vo.getEndDate()+" 23:59:59");
    	}
    	//工作量/完成情况
    	supervisionService.getStatistics(vo);
    	return AjaxResult.getResult(vo);
    }
    
}
